<template>
  <div class="ii-wrap">
    <div class="ii-wrap-left-tb">
      <!-- <div class="ii-wrap-left-t">
        <div class="ii-wrap-left-t-img"><img :src="ksAccount.headImg"></div>
        <span class="ii-wrap-left-t-text">{{ksAccount.nickName}}</span>
      </div> -->
      <div class="ii-wrap-left">
        <div class="ii-wrap-left-one" :class="provideGoods === 0 ? 'ii-line-active && ii-text-active': ''" @click="toggleIndex(0)">商品上传</div>
        <div class="ii-wrap-left-one" :class="provideGoods === 1 ? 'ii-line-active && ii-text-active': ''" @click="toggleIndex(1)">商品管理</div>
        <div class="ii-wrap-left-one" :class="provideGoods === 2 ? 'ii-line-active && ii-text-active': ''" @click="toggleIndex(2)">订单管理</div>
        <!-- <div class="ii-wrap-left-one" :class="kuaiShou === 3 ? 'ii-line-active && ii-text-active': ''" @click="toggleIndex(3)">我要选货</div> -->
      </div>
      </div>
    <div class="li-wrap-right">
      <nuxt-child/>
    </div>
  </div>
</template>
<script>
export default {
  async fetch({store}) {
    await store.commit('setInterIndex', 4)
    await store.commit('setMultiPlat', 4) //保留组件的存活状态
  },
  layout: 'internalouts', 
  components: {
    
  },
  computed: { 
    provideGoods(){
      return  this.$store.state.provideGoods
    }
  },
  data() {
    return {
      index: 0, // 初始索引值
      id:null,
      ksAccount: {},
    }
  },
  methods: {
    toggleIndex(index) {
      this.$store.commit('setProvideGoods', index)
      this.index = index
      if (index === 0) {
        this.go('/providegoods')
      } 
      if (index === 1) {
        this.go('/providegoods/manage')
      } 
      if (index === 2) {
        this.go('/providegoods/order')
        this.$router.push({
          path:'/providegoods/order',
          // query:{shopId:this.ksAccount.shopId},
        })
      } 
      // if (index === 3) {
      //   this.go('/pickGoodsHall')
      // } 
    },
    // getData(){ //热销商品
    //   let params ={
    //   }
    //   this.$axios.$post('hotsList',params).then(res => {
    //     if(res.status === 200 ){
    //     }else{
    //       this.$message.warning(res.msg)
    //     }
    //   })
    //   .catch(error => {
    //       this.$message.warning('请求失败')
    //   })
    // }
  },
  mounted(){
    this.ksAccount = localStorage.getItem('ksAccount') ? JSON.parse(localStorage.getItem('ksAccount')):{}
    // this.getData() 
  }
}
</script>

<style scoped>
  .ii-wrap {
    display: flex;
    justify-content: space-between;
    min-width:1200px;
  }
  .ii-wrap-left {
    background: #efefef;
    width: 220px;
    border-radius: 4px;
    font-weight:bold;
  }
  .li-wrap-right {
    flex:1;
    margin: 20px;
    min-width:940px;
  }
  .ii-wrap-left-one {
    border-bottom: 1px solid #f4f4f4;
    line-height: 50px;
    padding-left: 30px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    position: relative;
    user-select: none;
  }
  .ii-wrap-left-item {
    border-bottom: 1px solid #f4f4f4;
    padding-bottom: 20px;
    user-select: none;
  }
  .ii-wrap-left-item p {
    cursor: pointer;
  }
  .ii-wrap-left-item .p1 {
    font-size: 14px;
    color: #333;
    position: relative;
    height: 50px;
    line-height: 50px;
    padding-left: 30px;
  }
  .ii-wrap-left-item .p2 {
    font-size: 14px;
    color: #666;
    padding-left: 30px;
  }
 .ii-wrap-left-item .p3 {
    margin-top: 20px;
  }
  .ii-wrap-left-last {
    height: 50px;
    line-height: 50px;
    padding-left: 30px;
    font-size: 14px;  
    color: #333;
    cursor: pointer;
    position: relative;
    border-bottom: 1px solid #f4f4f4;
  }
  .ii-line-active::before {
    content: '';
    width: 3px;
    height: 26px;
    background: #0096e6;
    position: absolute;
    left: 0;
    top: 12px;
  }
  .ii-text-active {
    color: #0096e6 !important;
    background:#e6e6e6;
  }
  .ii-wrap-left-tb{
    width:220px;
    background:#efefef;
    box-shadow:0 -4px 5px #f4f4f4;
  }
  .ii-wrap-left-t{
    width:222px;
    height:120px;
    background:#ffffff;
    display:flex;
    align-items:center;
    flex-direction:column;
    justify-content:center;
    border-radius:4px;
  }
  .ii-bg-h{
    width:222px;
    height:20px;
    background:#f4f4f4
  }
  .ii-wrap-left-t-img{
    width:44px;
    height:44px;
  }
  .ii-wrap-left-t-img img{
    width:100%;
    height:100%;
  }
  .ii-wrap-left-t-text{
    font-size:16px;
    margin-top:13px;
    font-weight:400;
  }
</style>

